<?php

namespace app\adminapi\export;


use app\services\order\OrderService;

class OrderExport extends BaseExport
{
    protected $header = [
        '订单编号', '商品', '商品数量', '下单时间', '收货人','实收金额','经销商','订单状态','买家备注','卖家备注'
    ];

    public function createData(array $where)
    {
        $list = app()->make(OrderService::class)->getOrderList($where)['list'];

        $data = [];

        foreach ($list as $item) {
            foreach($item['products'] as $val){
                $data[] = [
                    $item['sn'],
                    $val['store_name'],
                    $val['nums'],
                    $item['add_time'],
                    $item['real_name'],
                    $item['price'],
                    $item['distributor'],
                    $item['status_name'],
                    $item['remark'] ?: '--',
                    $item['order_desc'] ?: '--'
                ];
            }
        }
        return $data;
    }
}